<!doctype>
<html>
	<head>
		<script>

var a = [];
for (var i = 0; i < 10; i++) {
  a[i] = function () {
    console.log(i);
  };
}
a[6](); // 10


		</script>
	</head>
	<body>
			
	</body>
</html>